<template>
    <fieldset>
        <legend>详情页</legend>
        <div class="detail">
            <h2>{{ detail.productName }}</h2>
            <h3>{{ detail.productInfo2 }}</h3>
            <h4>{{ detail.productPinkage }}</h4>
            <h5>{{ detail.productTime }}</h5>
        </div>
        <h3  v-if="isLoading">loading......</h3>
    </fieldset>
</template>
<script>
export default {
    // http://chst.vip:1234/api/getmoneyctrlproduct?productid=20 
    data() {
        return {
            detail: {},
            isLoading:true
        }
    },
    // 通过动态参数解耦合拿到productid
    props:['productid'],
    mounted() {
        // console.log(this.$route.params);
        console.log(this.productid);
        let { productid = 0 } = this.$route.params
        fetch(`http://chst.vip:1234/api/getmoneyctrlproduct?productid=${productid}`)
            .then(body => body.json())
            .then(res => {
                console.log(res);
                this.detail = res.result[0]
                // 关闭加载显示
                this.isLoading=false
            })
    }
}
</script>